<template>
  <div>
    <el-form class="input-form"
      label-position="left"
      label-width="120px"
      ref="editForm"
      :rules="propRules"
      :disabled="propReadonly"
      :model="form"
    >
      <el-form-item label="设备类型" prop="deviceType">
        <el-input v-model="form.deviceType" />
      </el-form-item>
      <el-form-item label="过期时间" prop="gmtExpire">
        <el-date-picker v-model="form.gmtExpire" type="date" format="yyyy/mm/dd" />
        </el-form-item>
      <el-form-item label="登录时间" prop="gmtLogin">
        <el-date-picker v-model="form.gmtLogin" type="date" format="yyyy/mm/dd" />
        </el-form-item>
      <el-form-item label="更新时间" prop="gmtModified">
        <el-date-picker v-model="form.gmtModified" type="date" format="yyyy/mm/dd" />
        </el-form-item>
      <el-form-item label="登录IP" prop="loginIp">
        <el-input v-model="form.loginIp" />
      </el-form-item>
      <el-form-item label="令牌" prop="token">
        <el-input v-model="form.token" />
      </el-form-item>
      <el-form-item label="用户编码" prop="userCode">
        <el-input v-model="form.userCode" />
      </el-form-item>
      </el-form>
  </div>
</template>

<script>

export default {
  data() {
    return {
      form: {},
      viewData: {}
    }
  },
  created() {
    this.$emit('event-register', {
      validate: (callback) => {
        this.$refs.editForm.validate(callback)
      },
      beforeSave: () => {
        this.$emit('data-callback', this.form)
        return true
      },
      afterMove: (formData, initData) => {
        this.form = global.utils.jsonClone(formData)
      },
      afterSave: () => {
        // 用作返回自动主键
        this.$set(this.form, this.propPrimaryKey, this.propViewFormData[this.propPrimaryKey])
      },
      beforeDelete: () => {
        return true
      },
      afterDelete: () => {
      },
      beforeFlow: (flowButtonKey) => {
        return true
      },
      afterFlow: (flowButtonKey) => {
      },
      beforeClose: () => {
        return true
      }
    })
  },
  props: ['propPrimaryKey', 'propDictionaries', 'propCurrentRow', 'propViewFormData', 'propReadonly', 'propStatus', 'propRules', 'propInitData'],
  components: {
  },
  computed: {
  }
}
</script>

<style lang="scss" scoped>
  .container {
    width: 100%;
    height: 100%;
  }
</style>
